[RLlib] Add Prometheus metrics to the selected RLlib components#57932
Merged
[RLlib] Add Prometheus metrics to the selected RLlib components#57932
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces Prometheus metrics to various components within RLlib, enhancing observability and monitoring capabilities. The changes are extensive and systematically add timing and counting metrics using a new TimerAndPrometheusLogger and ray.util.metrics. The implementation is consistent and well-structured. My review focuses on improving code clarity and design.
Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
It used to be in 3 different groups, now unionized in 1. Signed-off-by: kevin <kevin@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
…nter (#56848) * Updated preprocessors to use a callback-based approach for stat computation. This improves code organization and reduces duplication. * Added ValueCounter aggregator and value_counts method to BlockColumnAccessor. Includes implementations for both Arrow and Pandas backends. <!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [ ] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [ ] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: cem <cem@anyscale.com> Signed-off-by: cem-anyscale <cem@anyscale.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
…ging with Timer context manager Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
… only once." (#57917) This PR fixes the Ray check failure RayEventRecorder::StartExportingEvents() should be called only once.. The failure can occur in the following scenario: - The metric_agent_client successfully establishes a connection with the dashboard agent. In this case, RayEventRecorder::StartExportingEvents is correctly invoked to start sending events. - At the same time, the metric_agent_client exceeds its maximum number of connection retries. In this case, RayEventRecorder::StartExportingEvents is invoked again incorrectly, causing duplicate attempts to start exporting events. This PR introduces two fixes: - In metric_agent_client, the connection success and retry logic are now synchronized (previously they ran asynchronously, allowing both paths to trigger). - Do not call StartExportingEvents if the connection cannot be established. Test: - CI --------- Signed-off-by: Cuong Nguyen <can@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
## Description
Ray data can't serialize zero (byte) length numpy arrays:
```python3
import numpy as np
import ray.data
array = np.empty((2, 0), dtype=np.int8)
ds = ray.data.from_items([{"array": array}])
for batch in ds.iter_batches(batch_size=1):
print(batch)
```
What I expect to see:
```
{'array': array([], shape=(1, 2, 0), dtype=int8)}
```
What I see:
```
/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py:736: RuntimeWarning: invalid value encountered in scalar divide
offsets = np.arange(
2025-10-17 17:18:09,499 WARNING arrow.py:189 -- Failed to convert column 'array' into pyarrow array due to: Error converting data to Arrow: column: 'array', shape: (1, 2, 0), dtype: int8, data: []; falling back to serialize as pickled python objects
Traceback (most recent call last):
File "/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py", line 672, in from_numpy
return cls._from_numpy(arr)
^^^^^^^^^^^^^^^^^^^^
File "/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py", line 736, in _from_numpy
offsets = np.arange(
^^^^^^^^^^
ValueError: arange: cannot compute length
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py", line 141, in convert_to_pyarrow_array
return ArrowTensorArray.from_numpy(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py", line 678, in from_numpy
raise ArrowConversionError(data_str) from e
ray.air.util.tensor_extensions.arrow.ArrowConversionError: Error converting data to Arrow: column: 'array', shape: (1, 2, 0), dtype: int8, data: []
2025-10-17 17:18:09,789 INFO logging.py:293 -- Registered dataset logger for dataset dataset_0_0
2025-10-17 17:18:09,815 WARNING resource_manager.py:134 -- ⚠️ Ray's object store is configured to use only 33.5% of available memory (2.0GiB out of 6.0GiB total). For optimal Ray Data performance, we recommend setting the object store to at least 50% of available memory. You can do this by setting the 'object_store_memory' parameter when calling ray.init() or by setting the RAY_DEFAULT_OBJECT_STORE_MEMORY_PROPORTION environment variable.
{'array': array([array([], shape=(2, 0), dtype=int8)], dtype=object)}
```
This PR fixes the issue so that zero-length arrays are serialized
correctly, and the shape and dtype is preserved.
## Additional information
This is `ray==2.50.0`.
---------
Signed-off-by: Chris O'Hara <cohara87@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
use awscli directly; stop installing extra dependencies Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
## Description Found this while reading the docs. Not sure what this "Note that" is referring to or why it is there. Signed-off-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
…#57891) Signed-off-by: Seiji Eicher <seiji@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
it should not run on macos intel silicon anymore Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
f71c2ae to
88f6e3f
Compare
Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
…o kk/rllib-prometheus-metrics
Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com>
xinyuangui2
pushed a commit
to xinyuangui2/ray
that referenced
this pull request
Oct 22, 2025
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com> Signed-off-by: kevin <kevin@anyscale.com> Signed-off-by: cem <cem@anyscale.com> Signed-off-by: cem-anyscale <cem@anyscale.com> Signed-off-by: Cuong Nguyen <can@anyscale.com> Signed-off-by: Chris O'Hara <cohara87@gmail.com> Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Signed-off-by: Seiji Eicher <seiji@anyscale.com> Co-authored-by: Joshua Lee <73967497+Sparks0219@users.noreply.github.com> Co-authored-by: Kevin H. Luu <kevin@anyscale.com> Co-authored-by: cem-anyscale <cem@anyscale.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <128072568+can-anyscale@users.noreply.github.com> Co-authored-by: Chris O'Hara <cohara87@gmail.com> Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com> Co-authored-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Co-authored-by: Seiji Eicher <58963096+eicherseiji@users.noreply.github.com> Signed-off-by: xgui <xgui@anyscale.com>
elliot-barn
pushed a commit
that referenced
this pull request
Oct 23, 2025
## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com> Signed-off-by: kevin <kevin@anyscale.com> Signed-off-by: cem <cem@anyscale.com> Signed-off-by: cem-anyscale <cem@anyscale.com> Signed-off-by: Cuong Nguyen <can@anyscale.com> Signed-off-by: Chris O'Hara <cohara87@gmail.com> Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Signed-off-by: Seiji Eicher <seiji@anyscale.com> Co-authored-by: Joshua Lee <73967497+Sparks0219@users.noreply.github.com> Co-authored-by: Kevin H. Luu <kevin@anyscale.com> Co-authored-by: cem-anyscale <cem@anyscale.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <128072568+can-anyscale@users.noreply.github.com> Co-authored-by: Chris O'Hara <cohara87@gmail.com> Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com> Co-authored-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Co-authored-by: Seiji Eicher <58963096+eicherseiji@users.noreply.github.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
landscapepainter
pushed a commit
to landscapepainter/ray
that referenced
this pull request
Nov 17, 2025
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com> Signed-off-by: kevin <kevin@anyscale.com> Signed-off-by: cem <cem@anyscale.com> Signed-off-by: cem-anyscale <cem@anyscale.com> Signed-off-by: Cuong Nguyen <can@anyscale.com> Signed-off-by: Chris O'Hara <cohara87@gmail.com> Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Signed-off-by: Seiji Eicher <seiji@anyscale.com> Co-authored-by: Joshua Lee <73967497+Sparks0219@users.noreply.github.com> Co-authored-by: Kevin H. Luu <kevin@anyscale.com> Co-authored-by: cem-anyscale <cem@anyscale.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <128072568+can-anyscale@users.noreply.github.com> Co-authored-by: Chris O'Hara <cohara87@gmail.com> Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com> Co-authored-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Co-authored-by: Seiji Eicher <58963096+eicherseiji@users.noreply.github.com>
Aydin-ab
pushed a commit
to Aydin-ab/ray-aydin
that referenced
this pull request
Nov 19, 2025
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com> Signed-off-by: kevin <kevin@anyscale.com> Signed-off-by: cem <cem@anyscale.com> Signed-off-by: cem-anyscale <cem@anyscale.com> Signed-off-by: Cuong Nguyen <can@anyscale.com> Signed-off-by: Chris O'Hara <cohara87@gmail.com> Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Signed-off-by: Seiji Eicher <seiji@anyscale.com> Co-authored-by: Joshua Lee <73967497+Sparks0219@users.noreply.github.com> Co-authored-by: Kevin H. Luu <kevin@anyscale.com> Co-authored-by: cem-anyscale <cem@anyscale.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <128072568+can-anyscale@users.noreply.github.com> Co-authored-by: Chris O'Hara <cohara87@gmail.com> Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com> Co-authored-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Co-authored-by: Seiji Eicher <58963096+eicherseiji@users.noreply.github.com> Signed-off-by: Aydin Abiar <aydin@anyscale.com>
Future-Outlier
pushed a commit
to Future-Outlier/ray
that referenced
this pull request
Dec 7, 2025
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com> Signed-off-by: kevin <kevin@anyscale.com> Signed-off-by: cem <cem@anyscale.com> Signed-off-by: cem-anyscale <cem@anyscale.com> Signed-off-by: Cuong Nguyen <can@anyscale.com> Signed-off-by: Chris O'Hara <cohara87@gmail.com> Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Signed-off-by: Seiji Eicher <seiji@anyscale.com> Co-authored-by: Joshua Lee <73967497+Sparks0219@users.noreply.github.com> Co-authored-by: Kevin H. Luu <kevin@anyscale.com> Co-authored-by: cem-anyscale <cem@anyscale.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <128072568+can-anyscale@users.noreply.github.com> Co-authored-by: Chris O'Hara <cohara87@gmail.com> Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com> Co-authored-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Co-authored-by: Seiji Eicher <58963096+eicherseiji@users.noreply.github.com> Signed-off-by: Future-Outlier <eric901201@gmail.com>
simonsays1980
pushed a commit
to simonsays1980/ray
that referenced
this pull request
Dec 17, 2025
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com> Signed-off-by: kevin <kevin@anyscale.com> Signed-off-by: cem <cem@anyscale.com> Signed-off-by: cem-anyscale <cem@anyscale.com> Signed-off-by: Cuong Nguyen <can@anyscale.com> Signed-off-by: Chris O'Hara <cohara87@gmail.com> Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Signed-off-by: Seiji Eicher <seiji@anyscale.com> Co-authored-by: Joshua Lee <73967497+Sparks0219@users.noreply.github.com> Co-authored-by: Kevin H. Luu <kevin@anyscale.com> Co-authored-by: cem-anyscale <cem@anyscale.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <128072568+can-anyscale@users.noreply.github.com> Co-authored-by: Chris O'Hara <cohara87@gmail.com> Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com> Co-authored-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Co-authored-by: Seiji Eicher <58963096+eicherseiji@users.noreply.github.com>
Blaze-DSP
pushed a commit
to Blaze-DSP/ray
that referenced
this pull request
Dec 18, 2025
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <joshlee@anyscale.com> Signed-off-by: Kamil Kaczmarek <kamil@anyscale.com> Signed-off-by: kevin <kevin@anyscale.com> Signed-off-by: cem <cem@anyscale.com> Signed-off-by: cem-anyscale <cem@anyscale.com> Signed-off-by: Cuong Nguyen <can@anyscale.com> Signed-off-by: Chris O'Hara <cohara87@gmail.com> Signed-off-by: Lonnie Liu <lonnie@anyscale.com> Signed-off-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Signed-off-by: Seiji Eicher <seiji@anyscale.com> Co-authored-by: Joshua Lee <73967497+Sparks0219@users.noreply.github.com> Co-authored-by: Kevin H. Luu <kevin@anyscale.com> Co-authored-by: cem-anyscale <cem@anyscale.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <128072568+can-anyscale@users.noreply.github.com> Co-authored-by: Chris O'Hara <cohara87@gmail.com> Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com> Co-authored-by: Max van Dijck <50382570+MaxVanDijck@users.noreply.github.com> Co-authored-by: Seiji Eicher <58963096+eicherseiji@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR add prometheus metrics to the selected RLlib components.